new Vue({
    el: '#app',
    mixins: [Query],//组件配置文件，路径/utils/components.js
    data() {
        return {
            form: {//查询筛选
                value: '',
                value1: '',
                PageNumber: 1, //页码
                RowAmount: 20,
                Condition: utf8ToBase64("%%,%%"),
            },
        }
    },
    mounted() {
        /**
         * 组件配置文件中自动执行方法
         * 1.this.getColumn(); //查询表头数据
         * 2.this.getList(this.form); //查询表格数据
         * 3.this.getTreeData();//查询树
         */
    },
    methods: {
        handleSerach() { //筛选
            this.form.PageNumber = 1;
            this.form.Condition = utf8ToBase64(`%${this.form.value}%,%${this.form.value1}%`);
            this.getList(this.form);
        },
        handleShow(row) { //详情
            httpRequest({
                url: '/generalBusiness/generalQueryByTableName',
                data: {
                    Data: 'base_operation_log',
                    Condition: `Operation_SerialNumber='${row.Operation_SerialNumber}'`
                },
                type: 'GET'
            }).then(data => {
                console.log(data);
                const h = this.$createElement;
                this.$msgbox({
                    title: '查看提交JSON数据',
                    message: h('div', null, [
                        h('div', {
                            style: `padding:10px; 
                            border:1px solid #000;height:25vh;
                            border-radius: 4px;overflow: auto;`
                        }, data[0].Operation_Main),
                    ]),
                    showCancelButton: true,
                    closeOnClickModal: false,
                    confirmButtonText: '复制',
                    cancelButtonText: '关闭',
                    beforeClose: (action, instance, done) => {
                        if (action === 'confirm') {
                            // 点击确认时复制内容
                            navigator.clipboard.writeText(data[0].Operation_Main).then(() => {
                                this.$message.success('复制成功！');
                            }).catch(err => {
                                this.$message.error('复制失败，请手动复制！');
                            });
                        } else {
                            done(); // 点击取消时直接关闭
                        }
                    }
                }).then(() => { }).catch(() => { });
            }).catch(xhr => {
                this.$message({
                    message: '系统错误，请联系开发者!',
                    type: 'error'
                })
            })

        }
    }
})